<?php
declare (strict_types = 1);

namespace app\validate;

use think\Validate;

class ActivityValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require',
        'activity_id'=>'require',
        'activity_name'=>'require',
        // 'activity_url'=>'require',
        'start_time'=>'require',
        'end_time'=>'require',
        'status'=>'require',
        'post_link'=>'require',
        'add_time'=>'require',
        'update_time'=>'require',
        'type'=>'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => 'ID不能为空',
        'activity_id.require' => 'ID不能为空',
        'activity_name.require' => '活动名称不能为空',
        // 'activity_url.require' => '活动链接不能为空',
        'start_time.require' => '开始时间不能为空',
        'end_time.require' => '结束时间不能为空',
        'status.require' => '活动状态不能为空',
        'post_link.require' => '社区文章链接不能为空',
        'type.require' => '记录类型不能为空',
    ];

    protected $scene = [
        'edit'  =>  ['id','activity_name','start_time','end_time','status','post_link'],
        'add' => ['activity_name','start_time','end_time','status','post_link','type']
    ]; 
}
